An Introduction to Sessions in ASP.NET MVC Core 2.2

This article will demonstrate how to use session in ASP.NET core 2.1, 2.2. We will learn how to configure the session in the startup.cs class, sets a value of a session variable, and then read the value of that session and display it on the user interface. How to use Sessions in ASP.NET MVC Core... » read more

Calculate the average of array element using Java

Below is a program that calculates the average value of an array using Java. public static void main(String[] args) { int[] arr= new int[]{1,2,3,4,5}; int sum = 0; for(int count=0; count < arr.length ; count++) sum = sum + arr[count]; double average = sum / arr.length; System.out.println("The average value of the array elements is :... » read more

Get the sum of array element using Java

Here is a program in Java that sums up all array element and print out the result to the console. class Main { public static void main(String[] args) { int[] arr = {1,2,3,4,5}; int total = 0; for (int i = 0; i < arr.length; i++) total += arr[i]; System.out.printf("The sum of array elements is:... » read more

Get List of Installed Windows Services using C#

Below is a program that will return all installed Windows Services on a local machine. The program uses the namespace System.ServiceProcess, which can be used by adding the Assemblies System.ServiceProcess.dll static void Main(string[] args) { System.ServiceProcess.ServiceController[] services = System.ServiceProcess.ServiceController.GetServices(); foreach (System.ServiceProcess.ServiceController service in services) { Console.WriteLine(service.ServiceName); } Console.ReadKey(); } Happy Coding! More C# Snippets

Check if a number is prime using C#

Below is a program in C# that check whether a number is prime or not. The program inputs a value form the user and print whether it is prime or not. What is a prime number? Every number is a prime number or a composite number except 0 and 1. A prime number is a... » read more

An Explanation of Pass by Reference in C

In General, there are three methods of passing arguments. We pass arguments to a function during its call Pass by Reference Pass by value Pass by constant What is pass by reference? Pass by reference is a method of calling a function by passing the reference of a variable in the function’s arguments. The function... » read more

Get the square root of a number using Java

Square root can be easily obtained in Java by using the Math.sqrt function. The Math is a class in Java that contains methods that allows you to perform mathematical operations. System.out.println(Math.sqrt(9)); Result 3 More Java Snippets

A Beginners Guide to the Loop in WordPress

While discussing WordPress, specific themes, and plugin development, the loop is inevitably the most important concept. The loop is the heart of WordPress themes development, and when you are looking at any blog like tutorialspanel.com’s home page, you see the content fetched and displayed by the loop. An introduction to the Loop in WordPress In... » read more

Create a new Thread Delegate using C#

Below is a code that demonstrates how to create a Thread Delegate, which calls a function that will do some work for you in the background. static void Main(string[] args) { // Creating a thread Delegate System.Threading.Thread _thread = new System.Threading.Thread(new System.Threading.ThreadStart(FuctionDoBackgroundWork)); _thread.Start(); } // Fucntion that the thread delegate Starts public static void FuctionDoBackgroundWork()... » read more

Everything you need to know about CSS Box Model

If you want to be a front-end designer, you need to understand the basic concepts of CSS, like the Box model, Positions, overflow, etc. In this tutorial, I will be explaining the CSS Box Model and its usage in today’s web development. What is Box Model? No matter how simple or complex your website layout... » read more